package characters 
{
	import flash.errors.StackOverflowError;
	import flash.geom.Point;
	import org.flixel.*;
	import org.flixel.FlxSprite;
	
	/**
	 * ...
	 * @author JR
	 */
	public class MainMahouShoujo extends FlxSprite 
	{
		
		[Embed(source="../../assets/TestShoujo.png")]
		private static const mahouShoujoSprite : Class;
		
		private var speed:Number = 20;
		private var focusDrag:Number = 2.5;
		
		public function MainMahouShoujo(pos:Point) 
		{
			super(pos.x, pos.y, mahouShoujoSprite);
			this.maxVelocity.x = 10*this.speed;
			this.maxVelocity.y = 10*this.speed;
			
			this.drag.x = this.maxVelocity.x * 4;
			this.drag.y = this.maxVelocity.y * 4;
		}
		
		override public function update():void
		{
			moveChara();
			super.update();
		}
		
		private function moveChara():void
		{
			var deltaChange:Point = new Point(0, 0);
			
			if (FlxG.keys.UP)
			{
				deltaChange.y -= this.maxVelocity.y * 2;
			}
			
			if (FlxG.keys.DOWN)
			{
				deltaChange.y +=  this.maxVelocity.y * 2;
			}
			
			if (FlxG.keys.LEFT)
			{
				deltaChange.x -=  this.maxVelocity.x * 2;
			}
			
			if (FlxG.keys.RIGHT)
			{
				deltaChange.x +=  this.maxVelocity.x * 2;
			}
			
			if (FlxG.keys.SHIFT)
			{
				deltaChange.x /= this.focusDrag
				deltaChange.y /= this.focusDrag;
				
			}
			
			this.velocity.x = deltaChange.x;
			this.velocity.y = deltaChange.y;	
		}
		
	}

}